package PTA_4;
import java.util.*;

abstract class Ticket {
	private int number;
	public Ticket(int number) {
		this.number = number;
	}
	public abstract int getPrice();
	public String toString() {
		return "Number:"+number+",Price:"+getPrice();
	}
	public int getNumber() {
		return number;
	}
}
class WalkupTicket extends Ticket {
	public WalkupTicket(int number) {
		super(number);
	}
	public int getPrice() {
		return 50;
	}
	public String toString() {
		return "Number:"+this.getNumber()+",Price:"+this.getPrice();
	}
}
class AdvanceTicket extends Ticket {
	int leadTime;
	public AdvanceTicket(int number,int leadTime) {
		super(number);
		this.leadTime = leadTime;
	}
	@Override
	public int getPrice() {
		if(leadTime > 10)
			return 30;
		else
			return 40;
	}
	public String toString() {
		return "Number:"+this.getNumber()+",Price:"+this.getPrice();
	}
}
class StudentAdvanceTicket extends AdvanceTicket {
	int height;
	public StudentAdvanceTicket(int number,int leadTime,int height) {
		super(number,leadTime);
		this.height = height;
	}
	public int getPrice() {
		if(height > 120) {
			if(leadTime > 10)
				return 20;
			else 
				return 30;
		} else {
			if(leadTime > 10)
				return 10;
			else 
				return 15;
		}
	}
	public String toString() {
		return "Number:"+this.getNumber()+",Price:"+this.getPrice();
	}
}

public class t3 {
	public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        Ticket a = new WalkupTicket(in.nextInt());
        System.out.println(a.toString());
        Ticket b = new AdvanceTicket(in.nextInt(), in.nextInt());
        System.out.println(b.toString());
        Ticket c = new StudentAdvanceTicket(in.nextInt(), in.nextInt(), in.nextInt());
        System.out.println(c.toString());
    }
}
